﻿using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Web;
using BreezeEditor.Models;

namespace BreezeEditor
{
    public class TestDbInitializer : DropCreateDatabaseIfModelChanges<TestContext>
    {
        protected override void Seed(TestContext context)
        {
            Person p = new Person() { Name = "Binh" };
            Skill s1 = new Skill() { Name = "C++" };
            Category c = new Category() { Name = "Programming" };
            s1.Categories.Add(c);
            p.Skills.Add(s1);
            Skill s2 = new Skill() { Name = "Java" };
            s2.Categories.Add(new Category() { Name = "Java programming" });
            p.Skills.Add(s2);
            context.Persons.Add(p);

            Person p1 = new Person() { Name = "Hảo" };
            p1.Skills.Add(new Skill() { Name = "Testing" });
            p1.Skills.Add(new Skill() { Name = "Analysing" });
            context.Persons.Add(p1);

            context.SaveChanges();
        }
    }
}